<!doctype html>
<html>
	<head>
		<meta name="layout" content="main"/>
		<style type="text/css" media="screen">
		#page-body {
			margin:10px;		
		}
		
		</style>
		<g:javascript library="jquery" />
	</head>
	<body>
		<a href="#page-body" class="skip"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
			</ul>
		</div>
		<g:renderErrors bean="${user}" />
		<div id="page-body" role="main">
			<div id="options" >
			<g:form style="display: inline-block;" action="index" name="options" method="GET">
			<fieldset class = "box">
				<g:hiddenField name="weekOfYear" value="${params.weekOfYear }"/>
				<g:hiddenField name="month" value="${params.month }"/>
				<table class="simple">
					<tr>
						<td>
							<label><g:message code="absense.overview.eployees" /></label>
						</td>
						<td>
							<g:textField name="employees" value="${params.employees }" size="60" />
						</td>
					</tr>
					<tr>
						<td>
							<label><g:message code="absense.overview.view" /></label>
						</td>
						<td>
							<g:select name="view" from="${['week','month']}" value="${params.view }" />
						</td>
					</tr>
					<tr>
						<td><g:remoteLink controller="absence" action="getMyCollegues" update="usersList">My Collegues</g:remoteLink></td>
						<td><div id="usersList"></div></td>
					</tr>
					<tr>
						<td colspan="2">
							<g:actionSubmit class="btn"
								value="${message(code:'default.button.update.label')}"
								action="index" />	
						</td>
					</tr>
				</table>
			</fieldset>
			</g:form>
			</div>
			<table class="calendar">
				<tr>
					<th class="calHead"><g:message code="month"/> <br /><g:message code="day"/> <br /> <nobr><g:message code="dayOfWeek"/></nobr></th>
					<g:each in="${calDays}" var="day">
						<g:if test="${day.toCalendar().get(Calendar.DAY_OF_WEEK) in [Calendar.SATURDAY,Calendar.SUNDAY]}">
							<th class="calHead weekend">${day.format("MM")}<br />
														${day.format("dd")}<br />
														${day.format("E")}</th>
						</g:if>
						<g:else>
							<th class="calHead">${day.format("MM")}<br />
												${day.format("dd")}<br />
												${day.format("E")}</th>
						</g:else>
					</g:each>
				</tr>
			<g:each in="${rows}" var="row" status="i">
				<tr>
					<th class="calHead">${employees[i]}</th>	
					 <g:each in="${rows[i]}" var="cell">
						<g:render template="/Day/dayCell" model="['day':cell]" />
					 </g:each>
				</tr>
			</g:each>
			</table>
			<g:render template="navigation"/>
			<g:render template="balance"/>
		</div>
	</body>
</html>
